﻿@using Orchard.Utility.Extensions;
@using Orchard.Media.Helpers;
@using Contrib.BSCarouselSlide.Models;
@using Orchard.ContentManagement;
@using Orchard.DisplayManagement.Shapes;
@{
    string name = Model.ContentField.DisplayName;
    var carousel = ((IContent)Model.ContentPart).As<BSCarouselSlidePart>();
    bool HasText = carousel.HasText;
    bool HasImage = carousel.HasImage;
    var imageClass = carousel.ImageClass;
    string span= ( HasText ) ? "span7" : "span12"; 
    
}
@if (HasImage )
{
    <div class="@span @imageClass media-picker-field media-picker-field-@name.HtmlClassify()" style="text-align: center;">

        @if (Html.IsPicture((string)Model.ContentField.Url)) {
            <img src="@Url.Content(Model.ContentField.Url)"@if (!String.IsNullOrWhiteSpace(Model.ContentField.Class)) {
                     <text> class="@Model.ContentField.Class"</text>
                 }@if (!String.IsNullOrWhiteSpace(Model.ContentField.Style)) {
                     <text> style="@Model.ContentField.Style"</text>
                 }@if (!String.IsNullOrWhiteSpace(Model.ContentField.AlternateText)) {
                     <text> alt="@Model.ContentField.AlternateText"</text>
                 }/>
        }
        else if (!String.IsNullOrWhiteSpace(Model.ContentField.Url)) {
            <a href="@Url.Content(Model.ContentField.Url)" class="value">@name</a>
        }
    </div>
}
